package net.huashitong.ssydt.provider.pk.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.huashitong.ssydt.pk.entity.vo.PkInfoVO;
import net.huashitong.ssydt.provider.pk.service.PkService;
import net.huashitong.ssydt.provider.web.model.Result;
import net.huashitong.ssydt.provider.web.utils.ResultUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2017.12.22
 */
@Api(value = "/api/pk/", tags = {"pk挑战"})
@RestController
@RequestMapping("/api/pk/")
public class ApiPkController {

    private PkService pkService;

    @Autowired
    public ApiPkController(PkService pkService) {
        this.pkService = pkService;
    }

    @ApiOperation(value = "获取用户挑战信息", notes = "获取用户挑战信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @GetMapping("/info")
    public Result<PkInfoVO> getInfo(@ApiParam(value = "用户id") @RequestParam("userId") String userId) {
        PkInfoVO vo = pkService.getInfo(userId);
        return ResultUtils.getSuccessResults(vo);
    }


}

